<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="/assets/ico/favicon.png">
        <title>投票后台</title>
        <link href="/dist/css/bootstrap.css" rel="stylesheet" type="text/css">
        <link href="/css/survey.admin.css" rel="stylesheet" type="text/css">
        <!--[if lt IE 9]>
        <script src="../assets/js/html5shiv.js"></script>
        <script src="../assets/js/respond.min.js"></script>
        <![endif]-->
        <script src="/js/jquery.js" type="text/javascript"></script>
        <script src="/js/holder.js" type="text/javascript"></script>
        <script src="/js/json2.js" type="text/javascript"></script>
        <script src="/dist/js/bootstrap.min.js" type="text/javascript"></script>
        
        <link href="/css/datetimepicker.css" rel="stylesheet" type="text/css">
        <script src="/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
        <script src="/js/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script>
        <script src="/js/Validform.js"></script>

        <script src="/js/underscore-min.js"></script>
        <script src="/js/backbone-min.js"></script>
        <script src="/js/template.js"></script>   
        <script src="/js/jquery.validate.js"></script>
        <script src="/js/coral.common.js"></script> 
        <script src="/js/coral.survey.api.js"></script>   
    </head>
    <body>
        <div class="navbar-wrapper">
            <div class="">
                <div class="navbar navbar-inverse navbar-static-top">
                    <div class="container">
                        <div class="navbar-collapse collapse">
                            <ul class="nav navbar-nav">
                                <!--
                                <li class="dropdown">
                                <a class="dropdown-toggle" data-toggle="dropdown"  href="/poll/list">投票</a>
                                <ul class="dropdown-menu">
                                    <li class=""><a href="/poll/create">创建</a></li>
                                    <li class=""><a href="/poll/list">查看</a></li>
                                </ul>
                                </li>
                                -->
                                <li class=""><a href="/poll/list">投票</a></li>
                                
                                <!--
                                <li class="dropdown">
                                <a class="dropdown-toggle" data-toggle="dropdown"  href="/survey/">调查</a>
                                <ul class="dropdown-menu">
                                    <li class=""><a href="/survey/create">创建</a></li>
                                    <li class=""><a href="/survey/list">查看</a></li>
                                </ul>
                                </li>
                                <li><a href="/user/">用户</a></li>
                                <li><a href="/data/">数据</a></li>
                                -->
                            </ul>
                        </div>
                    </div>
                </div>

            </div>
        </div>
                <div class="container" id="main">
            <!--投票 增加 修改-->
            <div class="row" id="poll-info">
                <div class="col-md-12 left">
                    <div class="row">
                        <div class="col-md-12">
                             <div class="well well-sm">
                                <a class="btn btn-primary" href="/poll/create">创建</a>     
                             </div>
                        </div>
                    </div>
                    <table class="table">
                        <tr>
                            <th>ID</th>
                            <th width="320">投票名称</th>
                            <th>开始时间</th>
                            <th>结束时间</th>
                            <!--<th>状态</th>-->
                            <th>管理</th>
                        </tr>
                        <tbody id="poll-list">
                        </tbody>
                    </table>
                    <div class="pagination">
                        <a href="#" class="first" data-action="first">&laquo;</a>
                        <a href="#" class="previous" data-action="previous">&lsaquo;</a>
                        <input type="text" readonly="readonly" data-max-page="40" />
                        <a href="#" class="next" data-action="next">&rsaquo;</a>
                        <a href="#" class="last" data-action="last">&raquo;</a>
                    </div>
                   
                </div>
                
            </div>
        </div>

        <script type="text/html" id="poll-list-template">
            <tr>
                <td><%=id%></td>
                <td><a href="javascript:;" title="<%=title%>" class="btn-view"><%=shorttitle%></a></td>
                <td><%=starttime%></td>
                <td><%=endtime%></td>
                <!--<td><%if(pubstatus=="0"){%>未发布<%}else{%>已发布<%}%></td>-->
                <td>
                    <a target="_blank" href="/poll/<%=id%>/edit">修改</a>|<a href="javascript:void(0)" class="btn-view">查看</a><!--|<a target="_blank" href="http://panshi.qq.com/vote/<%=id%>/view">预览</a>-->|<a href="javascript:void(0)" class="btn-del">删除</a>
                </td>
            </tr>
        </script>
        <script type="test/html" id="survery-view-template">
            <table class="table">
            <tr>
                <td>ID</td>
                <td><%=id%></td>
            </tr>
            <tr>
                <td>标题</td>
                <td><%=title%></td>
            </tr>
            <tr>
                <td>总投票数</td>
                <td><%=votedtotal%></td>
            </tr>
            <tr>
                <td>组ID</td>
                <td><%=groupid%></td>
            </tr>
            <%for(var i in questions){%>
                <tr>
                    <td>题目</td>
                    <td>
                        <table>
                       
                            <tr>
                                <td>ID</td>
                                <td><%=questions[i]['subjectid']%></td>
                            </tr>
                            <tr>
                                <td>题目</td>
                                <td><%= questions[i]['title']%></td>
                            </tr>


                            <tr>
                                <td>选项</td>
                                <td>
                                    <table>
                                        <%var options = questions[i]['options'];
                                        for(var j in options){
                                            %>
                                            <tr>
                                                <td>ID:<%=options[j]['optionid']%></td>
                                                <td><%=options[j]['title']%></td>
                                                <td>票数:<%=options[j]['votedtotal']%></td>
                                                <td></td>
                                            </tr>
                                            <%
                                        }%>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            <%}%>
            
        </table>
        </script>
        
        <script src="/js/jquery.jqpagination.min.js" type="text/javascript"></script>
        <script src="/js/coral.poll.list.js" type="text/javascript"></script>
        
        <div class="modal fade" id="modal-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog" style="width:80%;">
            <div class="modal-content">
              <div class="modal-header">
                <a class="close" data-dismiss="modal" aria-hidden="true">&times;</a>
                <h4 class="modal-title" id="myModalLabel"></h4>
              </div>
              <div class="modal-body">
            
              </div>
              <div class="modal-footer">
                <a class="btn btn-default" data-dismiss="modal">取消</a>
                <a class="btn btn-primary">确定</a>
              </div>
            </div>
          </div>
        </div>
        
        <script>
        function actionNav() {
            var location = window.location.href;
            var query = window.location.search.substring(1);
            location = location.replace(query, '');
            location = location.replace('?', '');
            location = location.replace(/\//gi, '');
            
            $('.nav li').removeClass('active');
            $('.nav li a').each(function(i) {
                var href = $(this).attr('href') + '';
                href = href.replace(/\//gi, '');
                if (location.indexOf(href) >= 0) {
                    $(this).parents("li").addClass('active');
                }
            })
        }
        actionNav();
        </script> 
    </body>
</html>
